package com.yh.workbill.db;

import java.util.List;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

@Dao
public interface CompanyDao {

    @Insert
    void add(Company... company);

    @Delete
    void delect(Company... companies);

    @Query("DELETE FROM t_company WHERE companyname=:name")
    void delectName(String name);

    @Query("SELECT * FROM t_company")
    LiveData<List<Company>> getComanys();

    @Query("SELECT * FROM t_company WHERE companyname=:company_name ")
    Company getCompany(String company_name);

    @Query("UPDATE t_company SET id=:id WHERE companyname=:company_name")
    void update(long id, String company_name);
}
